package com.github.ocean.task.config;


import com.yl.css.report.export.task.ExportTaskExecutor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.File;


@Slf4j
@Component
public class ExportTaskInitConfig implements ApplicationRunner {

    @Resource
    private ExportTaskExecutor exportTaskExecutor;

    @Override
    public void run(ApplicationArguments args) {
        try {
            String url = FtExportJobConfig.URL_PREFIX;
            File file = new File(url);
            //如果文件夹不存在
            if (!file.exists()) {
                //创建文件夹
                file.mkdirs();
            }
            exportTaskExecutor.init();
        } catch (Exception e) {
            log.warn("FtJobInitConfig 出现异常", e);
        }
    }
}
